package router

import (
	"github.com/gin-gonic/gin"
	jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
	"tuowei.com/app/admin/apis"
	"tuowei.com/common/actions"
	"tuowei.com/common/middleware"
)

func init() {
	routerCheckRole = append(routerCheckRole, registerSysOrderRouter)
}

func registerSysOrderRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	order := apis.SysOrder{}
	r := v1.Group("/sys-order").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction())
	//在线订单新增
	r.POST("/addOnlineOrder", order.AddOnlineOrder)
	//更新在线订单
	r.POST("/updateOnlineOrder", order.UpdateOnlineOrder)
	// 获取在线订单列表
	r.GET("/getOnlineOrderList", order.GetOnlineOrderList)
	// 获取在线订单详情
	r.GET("/getOnlineOrderDetail", order.GetOnlineOrderDetail)

	//资料订单新增
	r.POST("/addMaterialOrder", order.AddMaterialOrder)
	//资料订单更新(状态，付款时间等)
	r.POST("/UpdateMaterialOrder", order.UpdateMaterialOrder)
	// 获取资料订单详情
	r.GET("/getMaterialOrderDetail", order.GetMaterialOrderDetail)
	// 获取资料订单列表
	r.GET("/getMaterialOrderList", order.GetMaterialOrderList)
	// 确认订单发货
	r.POST("/deliverGoods", order.DeliverGoods)

	//线下订单新增
	r.POST("/addOfflineOrder", order.AddOfflineOrder)
	// 线下订单详情
	r.GET("/getOfflineOrderDetail", order.GetOfflineOrderDetail)
	// 线下订单列表
	r.GET("/getOfflineOrderList", order.GetOfflineOrderList)
	// 线下订单复审确认
	r.POST("/offlineOrderRecheck", order.OfflineOrderRecheck)
	// 系统账单
	r.GET("/bill", order.GetBill)

	// 分配线下订单的时候需要获取
	r.POST("assignOrder", order.AssignOrder)
	// 下载
	r.GET(":signFlowId/fileDownloadUrl", order.FileDownloadUrl)
}
